// Copyright (c) 2020 Presto Labs Pte. Ltd.
// Author: leon

#include "coin2/exchange/ftx/symbology/currency.h"

#include <gtest/gtest.h>

TEST(FtxCurrency, constructor) {
  using namespace coin2::exchange::ftx::symbology;
  using coin2::exchange::base::market::ExchangeType;
  using coin2::exchange::base::market::MarketType;

  int64_t resolve_ts = 1572502253 * 1e9;

  FtxCurrency usdt("USDT");
  EXPECT_EQ(usdt.currency(), "USDT");
  EXPECT_EQ(usdt.native_currency(MarketType::Spot), "USDT");
  EXPECT_EQ(usdt.rep_currency(), "USD");
  EXPECT_EQ(usdt.exchange(), ExchangeType::Ftx);

  auto btc1 = FtxCurrency::FromNativeStr("BTC", resolve_ts);
  EXPECT_EQ(btc1.currency(), "BTC");
  EXPECT_EQ(btc1.native_currency(MarketType::Spot), "BTC");
  EXPECT_EQ(btc1.native_currency(MarketType::Futures), "BTC");
  EXPECT_EQ(btc1.exchange(), ExchangeType::Ftx);

  auto btc2 = FtxCurrency::FromNativeStr("BTC", resolve_ts);
  auto btc3 = FtxCurrency::FromNormStr("BTC", resolve_ts);
  auto btc4 = FtxCurrency::FromStr("BTC", resolve_ts);
  EXPECT_EQ(btc2, btc1);
  EXPECT_EQ(btc3, btc1);
  EXPECT_EQ(btc4, btc1);

  auto bch = FtxCurrency::FromStr("BCH", resolve_ts);
  EXPECT_EQ(bch.currency(), "BCHABC");
  EXPECT_EQ(bch.native_currency(MarketType::Spot), "BCH");
}
